package org.wukl.vhr.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wukl.vhr.mapper.EmployeeMapper;
import org.wukl.vhr.model.Employee;
import org.wukl.vhr.model.ResponsePageBean;

import java.util.List;

@Service
public class EmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;
    public ResponsePageBean getEmployeeByPage(Integer page,Integer size)
    {
        ResponsePageBean responsePageBean=new ResponsePageBean();
        if(page!=null && size!=null)
        {
            page=(page-1)*size;
        }
        responsePageBean.setDataRow(employeeMapper.getEmployeeByPage(page,size));
        responsePageBean.setTotalCount(employeeMapper.getEmployeeTotal());
        return responsePageBean;
    }
    public List<Employee> getAllEmployee()
    {
        return employeeMapper.getAllEmployee();
    }
}
